package com.linchong.concurrency.immutable;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @author linchong
 * @version 1.0
 * @Date: 2020-12-08 18:27
 * @Description: ImmutableExample3$
 */
@Slf4j
public class ImmutableExample3 {

	private final static ImmutableList<Integer> list = ImmutableList.of(1,2,3);

	private final static ImmutableSet<Integer> set = ImmutableSet.copyOf(list);

	private final static List<Integer> list2 = ImmutableList.of(1,2,3);

	private final static ImmutableMap<Integer,Integer> map = ImmutableMap.of(1,2,3,4);

	private final static ImmutableMap<Integer,Integer> map2 = ImmutableMap.<Integer,Integer>builder().put(1,2).put(3,4).build();


	public static void main(String[] args) {
		list.add(3);
		list2.add(3);
		map.put(2,3);
		map2.put(4,6);
	}

}
